<!-- toaster directive -->
<toaster-container toaster-options="{'position-class': 'toast-top-right', 'close-button':true}"></toaster-container>
<!-- / toaster directive -->

<!-- 导航条 -->
<div class="bg-white bread-crumb">
    <ul class="breadcrumb b-a m-b-n-xs lter b-b wrapper-md">
        <li><a ui-sref="main.tpl.homePage"><i class="fa fa-home"></i> 首页</a></li>
        <li class="active" ng-bind="title"></li>
    </ul>
</div>

<!-- 加载提醒 -->
<div ng-show="loading" class="text-center m-t-md text-lg"><i class="fa fa-spin fa-spinner"></i> 数据加载中...</div>

<!-- 内容区域 -->
<div ng-hide="loading" class="wrapper-md content">
    <!-- 数据显示 -->
    <div class="wrapper-data">
        <div class="panel panel-default">
            <!-- 头部 -->
            <div class="panel-body">
                <!--<div class="w-lg">-->
                <form ng-submit="searchRe()" class="form-horizontal">
                    <div class="form-group">

                        <div class="col-sm-2">
                            <input type="text" class="form-control" ng-model="searchParams.companyName"
                                   placeholder="广告主名称">
                        </div>
                        <div class="col-sm-2">
                            <input type="text" class="form-control" ng-model="searchParams.planName"
                                   placeholder="投放计划名称">
                        </div>
                        <div class="col-sm-2">
                            <input type="text" ng-model="searchParams.createStartTime" placeholder="申请开始时间"  class="form-control" id="createStartTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>

                        <div class="col-sm-2">
                            <input type="text" ng-model="searchParams.createEndTime" placeholder="申请结束时间"  class="form-control" id="createEndTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>

                        <div class="col-sm-2">
                            <input type="text" ng-model="searchParams.approveStartTime" placeholder="审核开始时间" class="form-control" id="approveStartTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>
                        <div class="col-sm-2">
                            <input type="text" ng-model="searchParams.approveEndTime" placeholder="审核结束时间" class="form-control" id="approveEndTime" onclick="laydate({istime: true, format: 'YYYY-MM-DD', start: laydate.now(0, 'YYYY-MM-DD')})"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2">
                            <select class="form-control" ng-model="searchParams.status">
                                <option value="">--全部状态--</option>
                                <option value="2">待审核</option>
                                <option value="3">审核通过</option>
                                <option value="4">审核失败</option>
                                <option value="5">取消</option>
                                <option value="6">暂停</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button class="ifc-btn btn-primary" ng-click="searchRe()" type="submit">查 询</button></label>
                        </div>
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button class="ifc-btn btn-dark" ng-click="clearSearch()" type="reset">清 空</button></label>
                        </div>
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button type="button" class="ifc-btn btn-success" ng-click="batchApprove(3)" >批量通过</button></label>
                        </div>
                        <div class="col-md-1">
                            <label class="col-sm-1 control-label"><button type="button" class="ifc-btn btn-danger"  ng-click="batchApprove(4)" >批量失败</button></label>
                        </div>
                    </div>
                </form>
                <!--</div>-->
            </div>

            <!-- 数据表格 -->
            <div class="table-responsive">
                <table class="table table-striped b-t b-light text-center">
                    <tr class="active">
                        <td><input type="checkbox" ng-click="selectAll($event)"/>全选</td>
                        <td>广告ID</td>
                        <td>广告主名称</td>
                        <td>计划名称</td>
                        <!--<td>广告标题</td>-->
                        <td>广告位名称</td>
                        <td>类型</td>
                        <td >广告位形式</td>
                        <!--<td >位置</td>-->
                        <td >价格</td>
                        <td >素材</td>
                        <td >申请时间</td>
                        <td >审核时间</td>
                        <!--<td >日限额</td>-->
                        <!--<td >总限额</td>-->
                        <td >状态</td>
                        <td >操作</td>
                    </tr>
                    <tr ng-repeat="item in pageInfo.records">
                        <td class="v-middle"><input type="checkbox" name="selected" ng-checked="isSelected(item.id)" ng-click="updateSelection($event,item)"/></td>
                        <td class="v-middle">
                            {{item.id}}
                        </td>
                        <td class="v-middle">
                            <span title="{{item.companyName}}">{{item.companyName | limitTo:10}}</span>
                        </td>
                        <td class="v-middle">
                            <span title="{{item.planName}}">{{item.planName | limitTo:10}}</span>
                        </td>
                        <!--<td class="v-middle">-->
                            <!--<span title="{{item.adTitle}}">{{item.adTitle | limitTo:10}}</span>-->
                        <!--</td>-->
                        <td class="v-middle">
                            <span title="{{item.adSlotName}}">{{item.adSlotName | limitTo:10}}</span>
                        </td>
                        <td class="v-middle">{{item.adType}}</td>
                        <td class="v-middle">{{item.adForm}}</td>
                        <td class="v-middle">¥{{item.clickPrice}} / ¥{{item.price}}</td>
                        <td class="v-middle"><a ng-if="item.adImg!=''&& item.adImg!=null" href="{{item.adImg}}" target="_blank">立即查看</a></td>
                        <td class="v-middle" >{{item.createTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
                        <td class="v-middle" >{{item.approveTime | date : 'yyyy-MM-dd HH:mm:ss'}}</td>
                        <!--<td class="v-middle">{{item.dailyLimit}}</td>-->
                        <!--<td class="v-middle">{{item.countLimit }}</td>-->
                        <td class="v-middle">{{item.state}}</td>
                        <td class="v-middle">
                            <div type="button" ng-if="item.state==='待审核' && item.planState==3" ng-click="approveAd(item.id,3)" class="btn btn-sm btn-primary m-l-xs">
                                <i class="fa fa-check m-r-xs text-sm"></i>确认</div>

                            <div type="button" ng-if="item.state==='待审核' && item.planState==3" ng-click="approveAd(item.id,4)" class="btn btn-sm btn-danger m-l-xs">
                                <i class="fa fa-ban m-r-xs text-sm"></i>失败</div>
                            <span ng-if="item.planState != 3">计划<span ng-if="item.planState==2">待审核</span><span ng-if="item.planState==1">未提交</span><span ng-if="item.planState==4">审核失败</span><span ng-if="item.planState==5">已取消</span><span ng-if="item.planState==6">已暂停</span><span ng-if="item.planState==7">已作废</span>
                            </span>
                        </td>
                    </tr>
                </table>
            </div><!-- /.table-responsive -->

            <!-- 底部分页 -->
            <span data-ng-include=" 'src/tpl/pageInfo.html' "></span>
        </div><!-- /.panel -->
    </div><!-- /.wrapper-data -->
    <form id="savePlan">
        <div class="modal fade bs-example-modal-lg" tabindex="-1" data-backdrop="static" id="refuseUserSupply" role="dialog" aria-labelledby="gridSystemModalLabelSupply">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="gridSystemModalLabelSupply" ><span id="title"></span>审核</h4>
                    </div>
                    <div class="modal-body">
                        <p></p>
                        <div class="row">
                            <label class="col-sm-2 control-label text-right">拒绝原因:</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" name="approveReason" maxlength="60" placeholder="请输入拒绝原因" ng-model="param.approveReason">
                            </div>
                        </div>
                        <p></p>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                        <button type="button" class="btn btn-primary" ng-click="saveApproveReason()">确定</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->
    </form>
</div><!-- /.wrapper-md -->